<?php 
	add_action('admin_menu', 'create_wordpress_admin_menu');  
	add_action('admin_menu', 'create_wordpress_admin_front_page_submenu');
	add_action('admin_menu', 'create_wordpress_admin_slider_submenu');
	add_action('admin_menu', 'create_wordpress_admin_blog_submenu');
	add_action('admin_menu', 'create_wordpress_admin_portfolio_submenu');
	add_action('admin_menu', 'create_wordpress_admin_content_scroller_submenu');
	add_action('admin_menu', 'create_wordpress_admin_contact_page_submenu');
	add_action('admin_menu', 'create_wordpress_admin_sidebars_submenu');
	add_action('admin_menu', 'create_wordpress_admin_footer_submenu');
	
	
	function create_wordpress_admin_menu()
	{  
		add_menu_page('ReFresh Option Panel', 'ReFresh Settings', 'manage_options', 'my-top-level-handle', 'ReFresh_settings'/*, get_template_directory_uri().'/theme_options/images/icon.png'*/);
		add_action('admin_init', 'register_general_settings');
	}
	
	function register_general_settings()
	{
		register_setting('general_options', 'logo_img');
		register_setting('general_options', 'logo_horizontal_alignment');
		register_setting('general_options', 'logo_vertical_alignment');
		register_setting('general_options', 'favicon');
		register_setting('general_options', 'header_logo_color');
		register_setting('general_options', 'header_menu_color');
		register_setting('general_options', 'site_tagline');
		register_setting('general_options', 'font_active');
		register_setting('general_options', 'cufon_font_selection');
		register_setting('general_options', 'font_face_selection');
		register_setting('general_options', 'go_to_top');
		
		register_setting('general_options', 'theme_color');
		register_setting('general_options', 'layout_style'); // boxed / full_width
		register_setting('general_options', 'theme_background_color');
		register_setting('general_options', 'theme_background_image');
		register_setting('general_options', 'theme_background_image_opacity');
		register_setting('general_options', 'theme_background_repeat');
		register_setting('general_options', 'theme_background_position');
		register_setting('general_options', 'theme_boxed_background_color');
		register_setting('general_options', 'theme_boxed_pattern');
		register_setting('general_options', 'theme_boxed_custom_pattern');
		register_setting('general_options', 'theme_boxed_pattern_opacity');
		register_setting('general_options', 'wrapper_width');
		register_setting('general_options', 'wrapper_margin_top');
		register_setting('general_options', 'wrapper_margin_bottom');
		register_setting('general_options', 'website_pattern');
				
		register_setting('general_options', 'article_related_items');
		register_setting('general_options', 'article_comments');
		register_setting('general_options', 'article_enable_sharing');
		register_setting('general_options', 'sidebar_position');
		register_setting('general_options', 'breadcrumb_active');
	
	
	}
	
	// the general settings
	if ( isset($_POST['general_settings_update']) && $_POST['general_settings_update'] == 'true')
	{
		general_settings_update();
	}
	
	function general_settings_update()
	{
		update_option( 'logo_img', stripslashes($_POST['logo_img']) );
		update_option( 'logo_horizontal_alignment', $_POST['logo_horizontal_alignment'] );
		update_option( 'logo_vertical_alignment', $_POST['logo_vertical_alignment'] );
		update_option( 'favicon', stripslashes($_POST['favicon']) );
		update_option( 'theme_color', $_POST['theme_color'] );
		update_option( 'header_logo_color', $_POST['header_logo_color'] );
		update_option( 'header_menu_color', $_POST['header_menu_color'] );
		update_option( 'site_tagline', $_POST['site_tagline'] );
		update_option( 'font_active', $_POST['font_active'] );
		update_option( 'cufon_font_selection', $_POST['cufon_font_selection'] );
		update_option( 'font_face_selection', $_POST['font_face_selection'] );
		update_option( 'go_to_top', $_POST['go_to_top'] );
	}
	
	// layout settings
	if ( isset($_POST['layout_update']) && $_POST['layout_update'] == 'true')
	{
		layout_update();
	}
	
	function layout_update()
	{
		update_option( 'layout_style', $_POST['layout_style'] );
		update_option( 'theme_background_color', $_POST['theme_background_color'] );
		update_option( 'theme_background_image', stripslashes($_POST['theme_background_image']) );
		update_option( 'theme_background_image_opacity', $_POST['theme_background_image_opacity'] );
		update_option( 'theme_background_repeat', $_POST['theme_background_repeat'] );
		update_option( 'theme_background_position', $_POST['theme_background_position'] );
		
		update_option( 'theme_boxed_background_color', $_POST['theme_boxed_background_color'] );
		update_option( 'theme_boxed_pattern', $_POST['theme_boxed_pattern'] );
		update_option( 'theme_boxed_custom_pattern', $_POST['theme_boxed_custom_pattern'] );
		update_option( 'theme_boxed_pattern_opacity', $_POST['theme_boxed_pattern_opacity'] );
		
		// remove "px" in case somebody writes px at the end
		$upload_wrapper_width = stripslashes($_POST['wrapper_width']);
		$upload_wrapper_width = str_replace( 'px', '', $upload_wrapper_width );
		
		update_option( 'wrapper_width', $upload_wrapper_width );
		
		$upload_wrapper_margin_top = stripslashes($_POST['wrapper_margin_top']);
		$upload_wrapper_margin_top = str_replace( 'px', '', $upload_wrapper_margin_top );
		
		update_option( 'wrapper_margin_top', $upload_wrapper_margin_top );
		
		$upload_wrapper_margin_bottom = stripslashes($_POST['wrapper_margin_bottom']);
		$upload_wrapper_margin_bottom = str_replace( 'px', '', $upload_wrapper_margin_bottom );
		
		update_option( 'wrapper_margin_bottom', $upload_wrapper_margin_bottom );	
		// END remove "px"
		
		
		update_option( 'website_pattern', $_POST['website_pattern'] );
	}
	
	// article settings
	if ( isset($_POST['article_settings_update']) && $_POST['article_settings_update'] == 'true')
	{
		article_settings_update();
	}
	
	function article_settings_update()
	{
		update_option( 'article_related_items', $_POST['article_related_items'] );
		update_option( 'article_comments', $_POST['article_comments'] );
		update_option( 'article_enable_sharing', $_POST['article_enable_sharing'] );
		update_option( 'sidebar_position', $_POST['sidebar_position'] );
		update_option( 'breadcrumb_active', $_POST['breadcrumb_active'] );
	}

	function ReFresh_settings() {
?>

<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/js/colorpicker/css/colorpicker.css" type="text/css" media="all" />


<script type="text/javascript">

jQuery(document).ready(function() {
			
	// upload buttons
	jQuery('.upload_logo').click(function() {
		 formfield = jQuery('.upload_logo_field').attr('name');
		 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
		 destination = 'logo_img';			 
		 return false;
	});
	
	jQuery('.upload_favicon').click(function() {
		 formfield = jQuery('.upload_favicon_field').attr('name');
		 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
		 destination = 'favicon_img';			 
		 return false;
	});
	
	jQuery('.upload_background').click(function() {
		 formfield = jQuery('.upload_background_field').attr('name');
		 tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
		 destination = 'background_img';			 
		 return false;
	});

	window.send_to_editor = function(html) {
		switch(destination)
		{
			case 'logo_img':
				imgurl = jQuery('img',html).attr('src');
				jQuery('.upload_logo_field').val(imgurl);
			break;
			
			case 'favicon_img':
				imgurl = jQuery('img',html).attr('src');
				jQuery('.upload_favicon_field').val(imgurl);
			break;
			
			case 'background_img':
				imgurl = jQuery('img',html).attr('src');
				jQuery('.upload_background_field').val(imgurl);
			break;
		}
		tb_remove();
	}
								
   
	// ColorPicker
   	jQuery('.colorbox').ColorPicker({
		onSubmit: function(hsb, hex, rgb, el) {
			jQuery(el).val(hex);

			jQuery(el).css({
				'background-color': '#'+hex

			});
			jQuery(el).ColorPickerHide();
			
		},
			onBeforeShow: function () {
				jQuery(this).ColorPickerSetColor(this.value);
			}
		})
		.bind('keyup', function(){
		jQuery(this).ColorPickerSetColor(this.value);
	
	});
		
	// Tabs
	jQuery("#general_settings_tabs").tabs();
	jQuery(".transform").jqTransform();
		
	// Range Sliders
	jQuery( "#logo_horizontal_align_slider" ).slider({
		range: "max",
		min: -100,
		max: 100,
		value: jQuery( "#logo_horizontal_alignment" ).val(),
		slide: function( event, ui )
		{
			jQuery( "#logo_horizontal_alignment" ).val( ui.value );
		}
	});
	
	jQuery( "#logo_vertical_align_slider" ).slider({
		range: "max",
		min: -100,
		max: 100,
		value: jQuery( "#logo_vertical_alignment" ).val(),
		slide: function( event, ui )
		{
			jQuery( "#logo_vertical_alignment" ).val( ui.value );
		}
	});
	
	jQuery( "#pattern_opacity_slider" ).slider({
		range: "max",
		min: 0.01,
		max: 1,
		value: jQuery( "#pattern_opacity" ).val(),
		step: 0.01,
		change: refreshPreview,
		slide: function( event, ui )
		{
			refreshPreview();
			jQuery( "#pattern_opacity" ).val( ui.value );
		}
	});
	
	jQuery( "#background_image_opacity_slider" ).slider({
		range: "max",
		min: 0.01,
		max: 1,
		step: 0.01,
		value: jQuery( "#background_image_opacity" ).val(),
		slide: function( event, ui )
		{
			jQuery( "#background_image_opacity" ).val( ui.value );
		}
	});
	
	jQuery( "#logo_horizontal_alignment" ).val( jQuery( "#logo_horizontal_align_slider" ).slider( "value" ) );
	jQuery( "#logo_vertical_alignment" ).val( jQuery( "#logo_vertical_align_slider" ).slider( "value" ) );
	jQuery( "#pattern_opacity_slider" ).val( jQuery( "#pattern_opacity" ).slider( "value" ) );
	jQuery( "#background_image_opacity_slider" ).val( jQuery( "#background_image_opacity" ).slider( "value" ) );
	
	function refreshPreview()
	{
		var prev_opacity = jQuery( "#pattern_opacity_slider" ).slider( "value" );
		
		jQuery( "#layout_preview" ).css( "opacity", prev_opacity );
	}

	
	
	/* PREDEFINED COLOR SCHEMES */
	
	jQuery( '#scheme_1' ).click(function() {
		jQuery( "#theme_color input" ).val( 'A9BE22' );
		jQuery( "#header_logo_color input" ).val( '9C0C1F' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_2' ).click(function() {
		jQuery( "#theme_color input" ).val( '9F3F2B' );
		jQuery( "#header_logo_color input" ).val( '1f733f' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_3' ).click(function() {
		jQuery( "#theme_color input" ).val( 'CE8952' );
		jQuery( "#header_logo_color input" ).val( '9D2629' );
		jQuery( "#header_menu_color input" ).val( '851A1D' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_4' ).click(function() {
		jQuery( "#theme_color input" ).val( '9D85B8' );
		jQuery( "#header_logo_color input" ).val( '7A2B70' );
		jQuery( "#header_menu_color input" ).val( '74728D' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_5' ).click(function() {
		jQuery( "#theme_color input" ).val( 'B27F58' );
		jQuery( "#header_logo_color input" ).val( 'AF565A' );
		jQuery( "#header_menu_color input" ).val( '835154' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_6' ).click(function() {
		jQuery( "#theme_color input" ).val( '8F3029' );
		jQuery( "#header_logo_color input" ).val( '9C0C1F' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_7' ).click(function() {
		jQuery( "#theme_color input" ).val( 'A55FC3' );
		jQuery( "#header_logo_color input" ).val( '621F7F' );
		jQuery( "#header_menu_color input" ).val( '91225A' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_8' ).click(function() {
		jQuery( "#theme_color input" ).val( '5868BD' );
		jQuery( "#header_logo_color input" ).val( '555E8E' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_9' ).click(function() {
		jQuery( "#theme_color input" ).val( 'A0A67C' );
		jQuery( "#header_logo_color input" ).val( '96707D' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_10' ).click(function() {
		jQuery( "#theme_color input" ).val( 'AC6649' );
		jQuery( "#header_logo_color input" ).val( '9C0C1F' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_11' ).click(function() {
		jQuery( "#theme_color input" ).val( 'B04538' );
		jQuery( "#header_logo_color input" ).val( 'B07438' );
		jQuery( "#header_menu_color input" ).val( 'B04538' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_12' ).click(function() {
		jQuery( "#theme_color input" ).val( 'AEB85B' );
		jQuery( "#header_logo_color input" ).val( '713F7C' );
		jQuery( "#header_menu_color input" ).val( '713F7C' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_13' ).click(function() {
		jQuery( "#theme_color input" ).val( '4A78B3' );
		jQuery( "#header_logo_color input" ).val( '6053BB' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_14' ).click(function() {
		jQuery( "#theme_color input" ).val( 'AB68B0' );
		jQuery( "#header_logo_color input" ).val( '60972C' );
		jQuery( "#header_menu_color input" ).val( '92AE78' );
		jQuery( '#general_primary_form' ).submit();
	});
	
	jQuery( '#scheme_15' ).click(function() {
		jQuery( "#theme_color input" ).val( '6083C1' );
		jQuery( "#header_logo_color input" ).val( '9C0C1F' );
		jQuery( "#header_menu_color input" ).val( '666666' );
		jQuery( '#general_primary_form' ).submit();
	});
	
});

</script>


<div class="wrap">
	<div id="icon-options-general" class="icon32"><br /></div>
	<h2>Lazar Options Panel</h2>
    
    <?php
	$get_admin_warnings = admin_warnings();
	if ( $get_admin_warnings != '' )
	{
		echo '<div id="admin_warnings">';
			echo '<div id="admin_warning_icon"></div>';
			echo $get_admin_warnings;
		echo '</div>';
	}
	?>

    <div id="general_settings_tabs" class="admin_tabs">
        <ul>
            <li>
                <a href="#tab_general_settings">
                    Settings
                </a>
            </li>
            <li>
                <a href="#tab_layout_settings">
                    Layout
                </a>
            </li>
            <li>
                <a href="#tab_article_settings">
                    Article Settings
                </a>
            </li>
        </ul>
        
        <form method="post" action="#tab_general_settings" class="transform" id="general_primary_form">
        	<input type="hidden" name="general_settings_update" value="true" />
            
            <div id="tab_general_settings"> 
    
                <div class="settings_wrapper">
                    <div class="header">
                        General Settings
                    </div>
                    
                    <div class="row_data">
                        <div class="row clearfix alternate">
                        	<label>Select a logo:</label>
                            <input type="text" name="logo_img" class="upload_logo_field input_box" value="<?php echo get_option('logo_img'); ?>" />
                            <input class="upload_logo browse_button" value="Browse" type="button" />
                        </div>
                        
                        <div class="row clearfix">
                        	<label>Logo Horizontal Alignment:</label>
                            <div id="logo_horizontal_align_slider" class="alignment_slider"></div>
                            <input type="text" id="logo_horizontal_alignment" name="logo_horizontal_alignment" class="input_box" style="width: 243px !important;" value="<?php echo get_option('logo_horizontal_alignment'); ?>" />
                        </div>

                        <div class="row clearfix alternate">
                        	<label>Logo Vertical Alignment:</label>
                            <div id="logo_vertical_align_slider" class="alignment_slider"></div>
                            <input type="text" id="logo_vertical_alignment" name="logo_vertical_alignment" class="input_box" style="width: 243px !important;" value="<?php echo get_option('logo_vertical_alignment'); ?>" />
                        </div>
                        
                        <div class="row clearfix">
                        	<label>Favicon:</label>
                            <input type="text" name="favicon" class="upload_favicon_field input_box" value="<?php echo get_option('favicon'); ?>" />
                            <input class="upload_favicon browse_button" value="Browse" type="button" />
                        </div>
                        
                        <div class="row clearfix alternate">
                        	<label>Manual Color Select</label>
                            <?php
                            $theme_color = get_option('theme_color', 'A9BE22');
                            echo '<div class="color_element clearfix">';
                                echo '<div class="colorbox_wrapper" id="theme_color">';
                                    echo '<input 
                                                type="text" 
                                                class="colorbox" 
                                                style="background-color: #'.$theme_color.';" 
                                                value="'.$theme_color.'" 
                                                name="theme_color" 
                                          />';
                                echo '</div>';
                                echo '<div class="info_text">theme color</div>';
                            echo '</div>';

                            $header_logo_color = get_option('header_logo_color', '8F1034');
							if ( $header_logo_color == '' ) $header_logo_color = '8F1034';
                            echo '<div class="color_element clearfix">';
                                echo '<div class="colorbox_wrapper" id="header_logo_color">';
                                    echo '<input 
                                                type="text" 
                                                class="colorbox" 
                                                style="background-color: #'.$header_logo_color.';" 
                                                value="'.$header_logo_color.'" 
                                                name="header_logo_color" 
                                          />';
                                echo '</div>';
                                echo '<div class="info_text">logo color</div>';
                            echo '</div>';
                            
                            $header_menu_color = get_option('header_menu_color', '666666');
							if ( $header_menu_color == '' ) $header_menu_color = '666666';
                            echo '<div class="color_element clearfix">';
                                echo '<div class="colorbox_wrapper" id="header_menu_color">';
                                    echo '<input 
                                                type="text" 
                                                class="colorbox" 
                                                style="background-color: #'.$header_menu_color.';" 
                                                value="'.$header_menu_color.'" 
                                                name="header_menu_color" 
                                          />';
                                echo '</div>';
                                echo '<div class="info_text">menu color</div>';
                            echo '</div>';
							?>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Predefined Color Schemes</label>
                            
                            <div class="predefined clearfix">
                            	<div class="predefined_scheme_wrapper">
                               		<a id="scheme_1">
                                		<div class="predefined_scheme">
                                        	<div class="actual_scheme default_scheme">
                                            	Default Colors
                                            </div>
                                    	</div>
                                    </a>
                                </div>
                                
                                <?php
								for ( $i = 2; $i < 16; $i++ )
								{
									echo '<div class="predefined_scheme_wrapper">';
										echo '<a id="scheme_'.$i.'">';
											echo '<div class="predefined_scheme">';
												echo '<div class="actual_scheme">';
													echo $i;
												echo '</div>';
											echo '</div>';
										echo '</a>';
									echo '</div>';
								}
								?>
                                
                            </div>
                        </div>
                        
                        <div class="row clearfix alternate">
                        	<label>Show Tagline:</label>
                            <select name="site_tagline" class="general_options_select">
                                <option value="1" <?php if ( get_option('site_tagline') == 1 ) echo ' selected="selected"'; ?>>Yes</option>
                                <option value="0" <?php if ( get_option('site_tagline') == 0 ) echo ' selected="selected"'; ?>>No</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
							<?php $webfonts_active = get_option('font_active'); if ( $webfonts_active == '' ) $webfonts_active = 'font-face'; ?>
                            <label>Use Webfonts:</label>
                            <select name="font_active" class="general_options_select">
                                <option value="font-face" <?php if ($webfonts_active == 'font-face') { echo 'selected="selected"'; } ?>>font-face</option>
                                <option value="cufon" <?php if ($webfonts_active == 'cufon') { echo 'selected="selected"'; } ?>>Cufon</option>
                                <option value="off" <?php if ($webfonts_active == 'off') { echo 'selected="selected"'; } ?>>Off</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">                
                            <?php $cufon_selected_font = get_option('cufon_font_selection'); if ( $cufon_selected_font == '' ) $cufon_selected_font = 'aller_light'; ?>
                            <label>Select cufon font:</label>
                            <select name="cufon_font_selection">
                                <option value="aller_light" <?php if ($cufon_selected_font == 'aller_light') { echo 'selected="selected"'; } ?>>Aller Light</option>
                                <option value="aller_regular" <?php if ($cufon_selected_font == 'aller_regular') { echo 'selected="selected"'; } ?>>Aller Regular</option>
                                <option value="aurulent_sans" <?php if ($cufon_selected_font == 'aurulent_sans') { echo 'selected="selected"'; } ?>>Aurulent Sans</option>
                                <option value="cantarell" <?php if ($cufon_selected_font == 'cantarell') { echo 'selected="selected"'; } ?>>Cantarell</option>
                                <option value="capture_it" <?php if ($cufon_selected_font == 'capture_it') { echo 'selected="selected"'; } ?>>Capture It</option>
                                <option value="caviar_dreams" <?php if ($cufon_selected_font == 'caviar_dreams') { echo 'selected="selected"'; } ?>>Caviar Dreams</option>
                                <option value="caviar_dreams_bold" <?php if ($cufon_selected_font == 'caviar_dreams_bold') { echo 'selected="selected"'; } ?>>Caviar Dreams Bold</option>
                                <option value="centabel_book" <?php if ($cufon_selected_font == 'centabel_book') { echo 'selected="selected"'; } ?>>Centabel Book</option>
                                <option value="colaborate_light" <?php if ($cufon_selected_font == 'colaborate_light') { echo 'selected="selected"'; } ?>>Colaborate Light</option>
                                <option value="colaborate_regular" <?php if ($cufon_selected_font == 'colaborate_regular') { echo 'selected="selected"'; } ?>>Colaborate Regular</option>
                                <option value="colaborate_thin" <?php if ($cufon_selected_font == 'colaborate_thin') { echo 'selected="selected"'; } ?>>Colaborate Thin</option>
                                <option value="district_thin" <?php if ($cufon_selected_font == 'district_thin') { echo 'selected="selected"'; } ?>>District Thin</option>
                                <option value="garogier" <?php if ($cufon_selected_font == 'garogier') { echo 'selected'; } ?>>Garogier</option>
                                <option value="geosans_light" <?php if ($cufon_selected_font == 'geosans_light') { echo 'selected="selected"'; } ?>>Geosans Light</option>
                                <option value="josefin" <?php if ($cufon_selected_font == 'josefin') { echo 'selected="selected"'; } ?>>Josefin</option>
                                <option value="oregon" <?php if ($cufon_selected_font == 'oregon') { echo 'selected="selected"'; } ?>>Oregon</option>
                                <option value="quicksand_book" <?php if ($cufon_selected_font == 'quicksand_book') { echo 'selected="selected"'; } ?>>Quicksand Book</option>
                                <option value="quicksand_light" <?php if ($cufon_selected_font == 'quicksand_light') { echo 'selected="selected"'; } ?>>Quicksand Light</option>
                                <option value="sansation_light" <?php if ($cufon_selected_font == 'sansation_light') { echo 'selected="selected"'; } ?>>Sansation light</option>
                                <option value="ubuntu" <?php if ($cufon_selected_font == 'ubuntu') { echo 'selected="selected"'; } ?>>Ubuntu</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">                
                            <?php $font_face_selected_font = get_option('font_face_selection'); if ( $font_face_selected_font == '' ) $font_face_selected_font = 'AllerLightRegular';  ?>
                            <label>Select font-face font:</label>
                            <select name="font_face_selection">
                                <option value="AllerLightRegular" <?php if ($font_face_selected_font == 'AllerLightRegular') { echo 'selected="selected"'; } ?>>Aller Light Regular</option>
                                <option value="Bebas_Neue" <?php if ($font_face_selected_font == 'Bebas_Neue') { echo 'selected="selected"'; } ?>>Bebas Neue</option>
                                <option value="Centabel_Book" <?php if ($font_face_selected_font == 'Centabel_Book') { echo 'selected="selected"'; } ?>>Centabel Book</option>
                                <option value="Garogier_unhinted" <?php if ($font_face_selected_font == 'Garogier_unhinted') { echo 'selected="selected"'; } ?>>Garogier Unhinted</option>
                                <option value="Hattori_Hanzo" <?php if ($font_face_selected_font == 'Hattori_Hanzo') { echo 'selected="selected"'; } ?>>Hattori Hanzo</option>
                                <option value="MountainsofChristmas" <?php if ($font_face_selected_font == 'MountainsofChristmas') { echo 'selected="selected"'; } ?>>Mountains of Christmas</option>
                                <option value="NobileRegular" <?php if ($font_face_selected_font == 'NobileRegular') { echo 'selected="selected"'; } ?>>Nobile Regular</option>
                                <option value="Ostrich_black" <?php if ($font_face_selected_font == 'Ostrich_black') { echo 'selected="selected"'; } ?>>Ostrich Black</option>
                                <option value="PlayfairDisplay_Regular" <?php if ($font_face_selected_font == 'PlayfairDisplay_Regular') { echo 'selected="selected"'; } ?>>Playfair Display Regular</option>
                                <option value="Quicksand_Book" <?php if ($font_face_selected_font == 'Quicksand_Book') { echo 'selected="selected"'; } ?>>Quicksand Book</option>
                                <option value="Tenderness" <?php if ($font_face_selected_font == 'Tenderness') { echo 'selected="selected"'; } ?>>Tenderness</option>
                                
                                <option value="AftaSansThinRegular" <?php if ($font_face_selected_font == 'AftaSansThinRegular') { echo 'selected="selected"'; } ?>>AftaSans Thin Regular</option>
                                <option value="Metrophobic" <?php if ($font_face_selected_font == 'Metrophobic') { echo 'selected="selected"'; } ?>>Metrophobic</option>
                                <option value="Molengo" <?php if ($font_face_selected_font == 'Molengo') { echo 'selected="selected"'; } ?>>Molengo</option>
                                <option value="DeliciousRoman" <?php if ($font_face_selected_font == 'DeliciousRoman') { echo 'selected="selected"'; } ?>>Delicious Roman</option>
                                
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Enable Go To Top Button:</label>
                            <select name="go_to_top" class="general_options_select">
                                <option value="yes" <?php if ( get_option('go_to_top') == 'yes' ) { echo 'selected="selected"'; } ?>>Yes</option>
                                <option value="no" <?php if ( get_option('go_to_top') == 'no' ) { echo 'selected="selected"'; } ?>>No</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                        	<input type="submit" name="search" value="Save changes" class="save_button" />	
                        </div>
                        
                    </div>
                    
                    <div class="footer">
                        General Settings
                    </div>
                    
                </div> <!-- .settings_wrapper -->
            
            </div> <!-- #tab_general_settings -->
        </form>
        
    	<form method="post" action="#tab_layout_settings" class="transform">
        	<input type="hidden" name="layout_update" value="true" />
            
            <div id="tab_layout_settings"> 
    
                <div class="settings_wrapper">
                    <div class="header">
                        Layout
                    </div>
                    
                    <div class="row_data">

                        <div class="row clearfix alternate">
                        	<label>Layout size:</label>
                            <select name="layout_style" onchange="this.form.submit()">
                                <option value="full_width" <?php if ( get_option('layout_style') == 'full_width' ) echo ' selected="selected"'; ?>>Full Width</option>
                                <option value="boxed" <?php if ( get_option('layout_style') == 'boxed' ) echo ' selected="selected"'; ?>>Boxed</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                         	<label>Theme Background Color</label>
                        	<?php
							
							$theme_background_color = get_option('theme_background_color', 'F4F4F4');
                            echo '<div class="color_element clearfix">';
                                echo '<div class="colorbox_wrapper">';
                                    echo '<input 
                                                type="text" 
                                                class="colorbox light_colorbox" 
                                                style="background-color: #'.$theme_background_color.';" 
                                                value="'.$theme_background_color.'" 
                                                name="theme_background_color" 
                                          />';
                                echo '</div>';
                                echo '<div class="info_text">background color *</div>';
                            echo '</div>';
							
							?>
                        </div>
                        
                        <div class="row clearfix alternate">
                        	<label>Select a background image:</label>
                            <input type="text" name="theme_background_image" class="upload_background_field input_box" value="<?php echo get_option('theme_background_image'); ?>" />
                            <input class="upload_background browse_button" value="Browse" type="button" />
                        </div>
                        
                        <?php
								
							$theme_background_image_opacity = get_option( 'theme_background_image_opacity' , '1' );
							if ( $theme_background_image_opacity == '' ) $theme_background_image_opacity = '1';
						
						?>
                        
                        <div class="row clearfix">
                        	<label>Background image opacity:</label>
                            <div id="background_image_opacity_slider" class="alignment_slider"></div>
                            <input type="text" id="background_image_opacity" name="theme_background_image_opacity" class="input_box" style="width: 243px !important;" value="<?php echo $theme_background_image_opacity; ?>" />
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Background image repeat:</label>
                            <select name="theme_background_repeat">
                                <option value="no-repeat" <?php if ( get_option('theme_background_repeat') == 'no-repeat' ) echo ' selected="selected"'; ?>>No Repeat</option>
                                <option value="repeat"    <?php if ( get_option('theme_background_repeat') == 'repeat' )    echo ' selected="selected"'; ?>>Repeat X & Y</option>
                                <option value="repeat-x"  <?php if ( get_option('theme_background_repeat') == 'repeat-x' )  echo ' selected="selected"'; ?>>Repeat X</option>
                                <option value="repeat-y"  <?php if ( get_option('theme_background_repeat') == 'repeat-y' )  echo ' selected="selected"'; ?>>Repeat Y</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                            <label>Background image position:</label>
                            <select name="theme_background_position">
                                <option value="top left"      <?php if ( get_option('theme_background_position') == 'top left' )      echo ' selected="selected"'; ?>>Top Left</option>
                                <option value="top center"    <?php if ( get_option('theme_background_position') == 'top center' )    echo ' selected="selected"'; ?>>Top Center</option>
                                <option value="top right"     <?php if ( get_option('theme_background_position') == 'top right' )     echo ' selected="selected"'; ?>>Top Right</option>
                                
                                <option value="center left"   <?php if ( get_option('theme_background_position') == 'center left' )   echo ' selected="selected"'; ?>>Center Left</option>
                                <option value="center center" <?php if ( get_option('theme_background_position') == 'center center' ) echo ' selected="selected"'; ?>>Center Center</option>
                                <option value="center right"  <?php if ( get_option('theme_background_position') == 'center right' )  echo ' selected="selected"'; ?>>Center Right</option>
                                
                                <option value="bottom left"   <?php if ( get_option('theme_background_position') == 'bottom left' )   echo ' selected="selected"'; ?>>Bottom Left</option>
                                <option value="bottom center" <?php if ( get_option('theme_background_position') == 'bottom center' ) echo ' selected="selected"'; ?>>Bottom Center</option>
                                <option value="bottom right"  <?php if ( get_option('theme_background_position') == 'bottom right' )  echo ' selected="selected"'; ?>>Bottom Right</option>
                            </select>
                        </div>

						<div class="row clearfix alternate">
                            <label>Boxed Layout BG Color & Pattern</label>
                            <?php
							
							$theme_boxed_background_color = get_option('theme_boxed_background_color', 'EEEEEE');
                            echo '<div class="color_element clearfix">';
                                echo '<div class="colorbox_wrapper">';
                                    echo '<input 
                                                type="text" 
                                                class="colorbox light_colorbox" 
                                                style="background-color: #'.$theme_boxed_background_color.';" 
                                                value="'.$theme_boxed_background_color.'" 
                                                name="theme_boxed_background_color" 
                                          />';
                                echo '</div>';
                                echo '<div class="info_text">boxed bg color</div>';
                            echo '</div>';
							
							?>
                            
                            <div style="width: 324px; float: left" class="clearfix">
                                <div class="color_element clearfix" style="width: 238px; height: 38px; margin-right: 0px;">
                                    <select name="theme_boxed_pattern" onchange="this.form.submit()">
                                    	<option value="no_pattern" <?php if ( get_option('theme_boxed_pattern') == 'no_pattern' ) echo ' selected="selected"'; ?>>No Pattern</option>
                                        <option value="01" <?php if ( get_option('theme_boxed_pattern') == '01' ) echo ' selected="selected"'; ?>>Dots</option>
                                        <option value="02" <?php if ( get_option('theme_boxed_pattern') == '02' ) echo ' selected="selected"'; ?>>Diagonal Line</option>
                                        <option value="03" <?php if ( get_option('theme_boxed_pattern') == '03' ) echo ' selected="selected"'; ?>>Diagonal Line 2</option>
                                        <option value="04" <?php if ( get_option('theme_boxed_pattern') == '04' ) echo ' selected="selected"'; ?>>Small x</option>
                                        <option value="05" <?php if ( get_option('theme_boxed_pattern') == '05' ) echo ' selected="selected"'; ?>>Dense Lines</option>
                                        <option value="06" <?php if ( get_option('theme_boxed_pattern') == '06' ) echo ' selected="selected"'; ?>>Dots 2</option>
                                        <option value="07" <?php if ( get_option('theme_boxed_pattern') == '07' ) echo ' selected="selected"'; ?>>Triangles</option>
                                        <option value="08" <?php if ( get_option('theme_boxed_pattern') == '08' ) echo ' selected="selected"'; ?>>Waves</option>
                                        <option value="09" <?php if ( get_option('theme_boxed_pattern') == '09' ) echo ' selected="selected"'; ?>>Dots 3</option>
                                        <option value="10" <?php if ( get_option('theme_boxed_pattern') == '10' ) echo ' selected="selected"'; ?>>Triangles 2</option>
                                        <option value="11" <?php if ( get_option('theme_boxed_pattern') == '11' ) echo ' selected="selected"'; ?>>Dots 4</option>
                                        <option value="12" <?php if ( get_option('theme_boxed_pattern') == '12' ) echo ' selected="selected"'; ?>>Dots + Lines</option>
                                        <option value="13" <?php if ( get_option('theme_boxed_pattern') == '13' ) echo ' selected="selected"'; ?>>Squares Dark</option>
                                        <option value="14" <?php if ( get_option('theme_boxed_pattern') == '14' ) echo ' selected="selected"'; ?>>Squares Light</option>
                                        <option value="15" <?php if ( get_option('theme_boxed_pattern') == '15' ) echo ' selected="selected"'; ?>>Lines Dark</option>
                                        <option value="16" <?php if ( get_option('theme_boxed_pattern') == '16' ) echo ' selected="selected"'; ?>>Lines Light</option>
                                        <option value="17" <?php if ( get_option('theme_boxed_pattern') == '17' ) echo ' selected="selected"'; ?>>Thick Lines 1</option>
                                        <option value="18" <?php if ( get_option('theme_boxed_pattern') == '18' ) echo ' selected="selected"'; ?>>Thick Lines 2</option>
                                        <option value="19" <?php if ( get_option('theme_boxed_pattern') == '19' ) echo ' selected="selected"'; ?>>Cool Pattern 1</option>
                                        <option value="20" <?php if ( get_option('theme_boxed_pattern') == '20' ) echo ' selected="selected"'; ?>>Cool Pattern 2</option>
                                    </select>
                                </div>
                                
                                <div class="right_note" style="text-align: left;">pattern overlay</div>
                                
                                <div style="float: left; width: 400px;">
                                    <input type="text" style="width: 237px; margin-left: 0px;" name="theme_boxed_custom_pattern" class="input_box" value="<?php echo get_option('theme_boxed_custom_pattern'); ?>" />
                                    <div class="right_note" style="text-align: left;">custom pattern</div>
                                </div>
                                
                                <?php
								
									$boxed_background_pattern_opacity = get_option( 'theme_boxed_pattern_opacity' , '0.5' );
									if ( $boxed_background_pattern_opacity == '' ) $boxed_background_pattern_opacity = '0.5';
								
								?>
                                
                                <div id="pattern_opacity_slider" class="alignment_slider" style="width: 236px; margin-right: 0px;"></div>
                                <div class="right_note" style="text-align: left; margin-top: -1px">pattern opacity</div>
                                <input type="text" id="pattern_opacity" name="theme_boxed_pattern_opacity" class="input_box" style="width: 237px !important;" value="<?php echo $boxed_background_pattern_opacity; ?>" />
                                
                                
                                
                            </div>
                            
                            <?php
							
							$boxed_background_pattern = get_option( 'theme_boxed_pattern' , 'no_pattern' );
							if ( $boxed_background_pattern == '' ) $boxed_background_pattern = 'no_pattern';
							
							$background_boxed_url = '';
							if ( $boxed_background_pattern != 'no_pattern' ) $background_boxed_url = get_template_directory_uri().'/patterns_box/'.$boxed_background_pattern.'.png';
							
							if ( get_option('theme_boxed_custom_pattern') != '' ) $background_boxed_url = get_option('theme_boxed_custom_pattern');

                            echo '<div class="color_element clearfix" style="margin-left: 23px; margin-right: 0px;">';
                                echo '<div class="colorbox_wrapper" style="width: 118px; height: 104px; padding: 0px; background-color: #'.$theme_boxed_background_color.';">';
                                    echo '<div id="layout_preview" class="box_preview light_colorbox"
									           style="width: 118px; height: 104px; 
											   	      opacity: '.$boxed_background_pattern_opacity.';
											          background-image: url(\''.$background_boxed_url.'\');">';
									echo '</div>';
                                echo '</div>';
                                echo '<div class="info_text">PREVIEW</div>';
                            echo '</div>';
							
							?>

                        </div>

                        <div class="row clearfix">
                            <label>Wrapper Width</label>
                            <input type="text" name="wrapper_width" class="input_box" value="<?php echo get_option('wrapper_width'); ?>" />
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Wrapper Top Margin</label>
                            <input type="text" name="wrapper_margin_top" class="input_box" value="<?php echo get_option('wrapper_margin_top'); ?>" />
                        </div>
                        
                        <div class="row clearfix">
                            <label>Wrapper Bottom Margin</label>
                            <input type="text" name="wrapper_margin_bottom" class="input_box" value="<?php echo get_option('wrapper_margin_bottom'); ?>" />
                        </div>
                        
                        <div class="row clearfix alternate">
                            <label>Pattern</label>
                            <select name="website_pattern" onchange="this.form.submit()">
                                <option value="01" <?php if ( get_option('website_pattern') == '01' ) echo ' selected="selected"'; ?>>No Pattern</option>
                                <option value="02" <?php if ( get_option('website_pattern') == '02' ) echo ' selected="selected"'; ?>>Small X</option>
                                <option value="03" <?php if ( get_option('website_pattern') == '03' ) echo ' selected="selected"'; ?>>Medium Chess Squares</option>
                                <option value="04" <?php if ( get_option('website_pattern') == '04' ) echo ' selected="selected"'; ?>>Thin Diagonal Lines</option>
                                <option value="05" <?php if ( get_option('website_pattern') == '05' ) echo ' selected="selected"'; ?>>Thin Vertical Lines</option>
                                <option value="06" <?php if ( get_option('website_pattern') == '06' ) echo ' selected="selected"'; ?>>Small Triangles</option>
                                <option value="07" <?php if ( get_option('website_pattern') == '07' ) echo ' selected="selected"'; ?>>Waves</option>
                                <option value="08" <?php if ( get_option('website_pattern') == '08' ) echo ' selected="selected"'; ?>>Small Circles</option>
                                <option value="09" <?php if ( get_option('website_pattern') == '09' ) echo ' selected="selected"'; ?>>Thick Diagonal Lines</option>
                                <option value="10" <?php if ( get_option('website_pattern') == '10' ) echo ' selected="selected"'; ?>>Medium Triangles</option>
                                <option value="11" <?php if ( get_option('website_pattern') == '11' ) echo ' selected="selected"'; ?>>Different Start Pixels</option>
                                <option value="12" <?php if ( get_option('website_pattern') == '12' ) echo ' selected="selected"'; ?>>Different Start Pixels 1/2 Opacity</option>
                                <option value="13" <?php if ( get_option('website_pattern') == '13' ) echo ' selected="selected"'; ?>>Horizontal lines 3 px appart</option>
                                <option value="14" <?php if ( get_option('website_pattern') == '14' ) echo ' selected="selected"'; ?>>Horizontal lines 5 px appart</option>
                                <option value="15" <?php if ( get_option('website_pattern') == '15' ) echo ' selected="selected"'; ?>>Diagonal Arrows</option>
                                <option value="16" <?php if ( get_option('website_pattern') == '16' ) echo ' selected="selected"'; ?>>Barcode Lines</option>
                                <option value="17" <?php if ( get_option('website_pattern') == '17' ) echo ' selected="selected"'; ?>>Small Double Diagonal Arrows</option>
                                <option value="18" <?php if ( get_option('website_pattern') == '18' ) echo ' selected="selected"'; ?>>Medium Double Diagonal Arrows</option>
                                <option value="19" <?php if ( get_option('website_pattern') == '19' ) echo ' selected="selected"'; ?>>Squares</option>
                                <option value="20" <?php if ( get_option('website_pattern') == '20' ) echo ' selected="selected"'; ?>>Grid</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                        	<input type="submit" name="search" value="Save changes" class="save_button" />
                            <div class="note">
                            	* We suggest you keep your background color between #000000 -> #161616
                            </div>

                        </div>
                        
                    </div>
                    
                    <div class="footer">
                        Layout
                    </div>
                    
                </div> <!-- .settings_wrapper -->
            </div> <!-- #tab_layout_settings -->
                      
        </form>
        
        <form method="post" action="#tab_article_settings" class="transform">
        	<input type="hidden" name="article_settings_update" value="true" />
            
            <div id="tab_article_settings"> 
    
                <div class="settings_wrapper">
                    <div class="header">
                        Article Settings
                    </div>
                    
                    <div class="row_data">
                        <div class="row clearfix alternate">
                            <label>Article Related Items:</label>
                            <select name="article_related_items">
                                <option value="category_related" <?php if ( get_option('article_related_items') == 'category_related' ) echo ' selected="selected"'; ?>>Category Related</option>
                                <option value="tag_related" <?php if ( get_option('article_related_items') == 'tag_related' ) echo ' selected="selected"'; ?>>Tag Related</option>
                                <option value="off" <?php if ( get_option('article_related_items') == 'off' ) echo ' selected="selected"'; ?>>Off</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
							<label>Article Enable Sharing:</label>
                            <select name="article_enable_sharing">
                                <option value="yes" <?php if ( get_option('article_enable_sharing') == 'yes' ) echo ' selected="selected"'; ?>>Yes</option>
                                <option value="no"  <?php if ( get_option('article_enable_sharing') == 'no' )  echo ' selected="selected"'; ?>>No</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">                
							<label>Comments:</label>
                            <select name="article_comments">
                                <option value="yes" <?php if ( get_option('article_comments') == 'yes' ) echo ' selected="selected"'; ?>>Yes</option>
                                <option value="no" <?php if ( get_option('article_comments') == 'no' ) echo ' selected="selected"'; ?>>No</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                        	<label>Sidebar enable & position:</label>
                            <select name="sidebar_position">
                                <option value="right" <?php if ( get_option('sidebar_position') == 'right' ) echo ' selected="selected"'; ?>>Right</option>
                                <option value="left"  <?php if ( get_option('sidebar_position') == 'left' )  echo ' selected="selected"'; ?>>Left</option>
                                <option value="off" <?php if ( get_option('sidebar_position') == 'off' ) echo ' selected="selected"'; ?>>Off</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix alternate">                
							<label>Breadcrumbs Navigation:</label>
                            <select name="breadcrumb_active">
                            	<option value="no" <?php if ( get_option('breadcrumb_active') == 'no' ) echo ' selected="selected"'; ?>>No</option>
                                <option value="yes" <?php if ( get_option('breadcrumb_active') == 'yes' ) echo ' selected="selected"'; ?>>Yes</option>
                            </select>
                        </div>
                        
                        <div class="row clearfix">
                        	<input type="submit" name="search" value="Save changes" class="save_button" />	
                        </div>
                        
                    </div>
                    
                    <div class="footer">
                        Article Settings
                    </div>
                    
                </div> <!-- .settings_wrapper -->
            
            </div> <!-- #tab_article_settings -->
        </form>
        
	</div> <!-- #general_settings_tabs -->

</div> <!--end of wrap -->   
<?php } ?>
